

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>ceph-kvstore-tool – ceph 的 kvstore 操作工具 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="ceph-run – 发生核心转储后重启守护进程" href="../ceph-run/" />
    <link rel="prev" title="ceph-osd – ceph 对象存储守护进程" href="../ceph-osd/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../../rados/">Ceph 存储集群</a> &raquo;</li>
        
          <li><a href="../../../rados/man/">对象存储手册页</a> &raquo;</li>
        
      <li>ceph-kvstore-tool – ceph 的 kvstore 操作工具</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/man/8/ceph-kvstore-tool.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../../rados/configuration/">配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../rados/operations/">运维</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../../rados/man/">    手册页</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../ceph-volume/">ceph-volume – Ceph OSD 部署和检查工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-volume-systemd/">ceph-volume-systemd – systemd ceph-volume 辅助工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph/">ceph – Ceph 管理工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-authtool/">ceph-authtool – ceph 密钥环操作工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-clsinfo/">ceph-clsinfo – 查看类对象信息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-conf/">ceph-conf – ceph 配置文件工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-debugpack/">ceph-debugpack – ceph 调试信息打包工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-dencoder/">ceph-dencoder – ceph 编码器/解码器工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-mon/">ceph-mon – ceph 监视器守护进程</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-osd/">ceph-osd – ceph 对象存储守护进程</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">ceph-kvstore-tool – ceph 的 kvstore 操作工具</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">提纲</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">描述</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3">命令</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">使用范围</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">参考</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-run/">ceph-run – 发生核心转储后重启守护进程</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-syn/">ceph-syn – ceph 的人造负载生成器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crushdiff/">crushdiff – ceph crush 图测试工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crushtool/">crushtool – CRUSH 图操作工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../librados-config/">librados-config – 显示关于 librados 的信息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monmaptool/">monmaptool – ceph 监视器运行图操作工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../osdmaptool/">osdmaptool – ceph osd 运行图操作工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rados/">rados – rados 对象存储工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-post-file/">ceph-post-file – 把文件上传给 ceph 开发者</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../rados/troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../rados/api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="ceph-kvstore-tool-ceph-kvstore">
<h1>ceph-kvstore-tool – ceph 的 kvstore 操作工具<a class="headerlink" href="#ceph-kvstore-tool-ceph-kvstore" title="Permalink to this headline">¶</a></h1>
<div class="section" id="id1">
<h2>提纲<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<div class="line-block">
<div class="line"><strong>ceph-kvstore-tool</strong> &lt;leveldb|rocksdb|bluestore-kv&gt; &lt;store path&gt; <em>command</em> [args…]</div>
</div>
</div>
<div class="section" id="id2">
<h2>描述<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p><strong class="program">ceph-kvstore-tool</strong> 是个 kvstore （键值存储）操作工具，可以用来离线操作 leveldb/rocksdb 的数据（比如 OSD 的 omap ）。</p>
</div>
<div class="section" id="id3">
<h2>命令<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<p><strong class="program">ceph-kvstore-tool</strong> 工具有很多命令，可用于调试，如下：</p>
<dl class="simple">
<dt><strong class="command">list [prefix]</strong></dt><dd><p>打印所有键值对的键名，有 URL 编码的前缀时只打印匹配的。</p>
</dd>
<dt><strong class="command">list-crc [prefix]</strong></dt><dd><p>打印所有键值对的 CRC 校验码，有 URL 编码的前缀时只打印匹配的。</p>
</dd>
<dt><strong class="command">dump [prefix]</strong></dt><dd><p>打印所有键值对的键名及其值，有 URL 编码的前缀时只打印匹配的。</p>
</dd>
<dt><strong class="command">exists &lt;prefix&gt; [key]</strong></dt><dd><p>查验是否存在以此 URL 为前缀的键值对；如果指定了键名，就只查验带有此前缀的键名。</p>
</dd>
<dt><strong class="command">get &lt;prefix&gt; &lt;key&gt; [out &lt;file&gt;]</strong></dt><dd><p>通过 URL 编码存储的 prefix 和 key 获取 KV 对的值。
如果指定了文件，把此值写入该文件。</p>
</dd>
<dt><strong class="command">crc &lt;prefix&gt; &lt;key&gt;</strong></dt><dd><p>通过 URL 编码存储的 prefix 和 key 获取 KV 对的 CRC 。</p>
</dd>
<dt><strong class="command">get-size [&lt;prefix&gt; &lt;key&gt;]</strong></dt><dd><p>获取 prefix 和 key 所指内容的大概尺寸、或是值的尺寸。</p>
</dd>
<dt><strong class="command">set &lt;prefix&gt; &lt;key&gt; [ver &lt;N&gt;|in &lt;file&gt;]</strong></dt><dd><p>通过 URL 编码存储的 prefix 和 key 设置 KV 对的值。
这个值可以是 <em>version_t</em> 或文本。</p>
</dd>
<dt><strong class="command">rm &lt;prefix&gt; &lt;key&gt;</strong></dt><dd><p>删除 URL 编码的 prefix 和 key 的 KV 对。</p>
</dd>
<dt><strong class="command">rm-prefix &lt;prefix&gt;</strong></dt><dd><p>删除 URL 编码存储的 prefix 之下的所有 KV 对。</p>
</dd>
<dt><strong class="command">store-copy &lt;path&gt; [num-keys-per-tx]</strong></dt><dd><p>把所有 KV 对都复制到 <code class="docutils literal notranslate"><span class="pre">path</span></code> 目录里。
[num-keys-per-tx] 是一个事务可以复制的 KV 对数量。</p>
</dd>
<dt><strong class="command">store-crc &lt;path&gt;</strong></dt><dd><p>把所有 KV 对的 CRC 都存储到 <code class="docutils literal notranslate"><span class="pre">path</span></code> 内的一个文件里。</p>
</dd>
<dt><strong class="command">compact</strong></dt><dd><p>子命令 <code class="docutils literal notranslate"><span class="pre">compact</span></code> 用于压缩 kvstore 的所有数据。
它会打开数据库、触发数据库的压缩功能。压缩后，
会释放一些磁盘空间。</p>
</dd>
<dt><strong class="command">compact-prefix &lt;prefix&gt;</strong></dt><dd><p>压缩 URL 编码的 prefix 相关的所有条目。</p>
</dd>
<dt><strong class="command">compact-range &lt;prefix&gt; &lt;start&gt; &lt;end&gt;</strong></dt><dd><p>压缩由 URL 编码的 prefix 和范围确定的那些条目。</p>
</dd>
<dt><strong class="command">destructive-repair</strong></dt><dd><p>尽力（有可能是破坏性地）恢复损坏的数据库。
注意，底层是 rocksdb 时，此操作可能会损坏本来正常的数据库——
此命令只能作为终极手段！</p>
</dd>
<dt><strong class="command">stats</strong></dt><dd><p>打印底层键值数据库的统计信息，这只是个信息来源。
格式和信息内容随版本变化频繁，对于 RocksDB ，
包含的信息有压缩统计信息、性能计数器、内存使用率和 RocksDB 内部统计信息。</p>
</dd>
<dt><strong class="command">histogram</strong></dt><dd><p>呈现出底层 KV 数据库的键/值尺寸分布情况统计。</p>
</dd>
</dl>
</div>
<div class="section" id="id4">
<h2>使用范围<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
<p><strong>ceph-kvstore-tool</strong> 是 Ceph 的一部分，这是个伸缩力强、开源、分布式的存储系统，更多信息参见 <a class="reference external" href="https://docs.ceph.com">https://docs.ceph.com</a> 。</p>
</div>
<div class="section" id="id5">
<h2>参考<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="../ceph/"><span class="doc">ceph</span></a>(8)</p>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../ceph-run/" class="btn btn-neutral float-right" title="ceph-run – 发生核心转储后重启守护进程" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../ceph-osd/" class="btn btn-neutral float-left" title="ceph-osd – ceph 对象存储守护进程" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>